// @APIVersion 1.0.0
// @Title mobile API
// @Description mobile has every tool to get any job done, so codename for the new mobile APIs.
// @Contact astaxie@gmail.com
package routers

import (
	"github.com/astaxie/beego"
	_ "myadmin/sys"
	"myadmin/sys/filter"
	"myadmin/sys/syscontrollers"
)

func init() {
	//beego.Router("/", &controllers.MainController{})
	beego.Router("/", &syscontrollers.ViewHome{})
	beego.Router("/login", &syscontrollers.ViewLogin{})
	ns := beego.NewNamespace("/api",
		beego.NSRouter("/login",&syscontrollers.ViewLogin{}),
		//添加过滤器

		beego.NSNamespace("/sys",
			//beego.NSBefore(filter.AuthLogin),
			//beego.NSBefore(filter.Auth),
			beego.NSInclude(
				&syscontrollers.SysUsers{},
				&syscontrollers.SysRole{},
				&syscontrollers.SysAuth{},
			),
		),
		beego.NSNamespace("/user",
			beego.NSBefore(filter.AuthLogin),
			beego.NSInclude(
				&syscontrollers.User{},
			),
			beego.NSInclude(
				&syscontrollers.UserLogout{},
			),
		),
	)
	beego.AddNamespace(ns)
}
